
import { createStore,applyMiddleware } from "redux";
import  reducer  from "./reducer";
import thunk from "redux-thunk";
import logger from "redux-logger";
import { persistStore,persistReducer } from 'redux-persist'
import storage from "redux-persist/lib/storage";

//对原有的reducer 进行处理 生成 持久化的reducer
var persistedReducer=persistReducer({key:'root',storage  },reducer)

// 创建一个唯一的store
var store =createStore(persistedReducer,applyMiddleware( thunk,logger))

// 对唯一的store进行持久化处理，生成 持久化的store
var persistor=persistStore(store)

export{
    store,
    persistor
}